-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make native redirect code a query param #1003
Make native redirect code a query param #1003
Conversation
@@ -154,7 +154,7 @@ def translated_error_message(key) | |||
|
|||
it 'should redirect immediately' do | |||
expect(response).to be_redirect | |||
expect(response.location).to match(/oauth\/authorize\//) | |||
expect(response.location).to match(/oauth\/authorize\/native?code=/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %r around regular expression.
@@ -49,7 +49,7 @@ def authorization_routes(mapping) | |||
as: mapping[:as], | |||
controller: mapping[:controllers] | |||
) do | |||
routes.get '/:code', action: :show, on: :member | |||
routes.get '/native', action: :show, on: :member |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
267a544
to
185c9f5
Compare
@@ -154,7 +154,7 @@ def translated_error_message(key) | |||
|
|||
it 'should redirect immediately' do | |||
expect(response).to be_redirect | |||
expect(response.location).to match(/oauth\/authorize\//) | |||
expect(response.location).to match(/oauth\/authorize\/native\?code=#{Doorkeeper::AccessGrant.first.token}/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %r around regular expression.
Line is too long. [113/80]
@@ -29,6 +29,7 @@ | |||
|
|||
access_grant_should_exist_for(@client, @resource_owner) | |||
|
|||
url_should_have_param('code', Doorkeeper::AccessGrant.first.token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
90c5ca0
to
7dea128
Compare
This allows for automated flows to detect that an Authorization code was granted in much the same way as a normal redirect. This is used by e.g. Mac Paw.
7dea128
to
2236363
Compare
Hey @nbulaj, thanks! Did as requested, is this ok? |
Great, thanks @dv! |
Remove changes from doorkeeper PR doorkeeper-gem#1003
Revert "Remove changes from doorkeeper PR doorkeeper-gem#1003"
Using native redirect, instead of redirecting to
oauth/authorize/abc123abc123
it redirects to
oauth/authorize/native?code=abc123abc123
This allows for automated flows to detect that an Authorization code was granted in much the same way as a normal redirect. This is used by e.g. Mac Paw (and possibly Postman) to detect whether a code was given or not. I'm not sure if this was intentional or not, but adding the code as an actual param would make sense to mimic the non-oob flow as much as possible, gaining support by any software that works with non-oob flow.
Before:
After:
Related